package com.qf.servlet;

import com.qf.entity.Student;
import com.qf.util.DateUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/querystudent")
public class QueryStudentServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException {
       List<Student> students= DateUtils.queryStudent();
        System.out.println(students);
       request.setAttribute("stus",students);
//       resp.sendRedirect("querystudent.jsp");

       request.getRequestDispatcher("querystudent.jsp").forward(request,resp);
    }
}
